using Param;
using System.Net;

namespace FrameIdentityReq
{
    public class CraneParams
    {
        public IPAddress RemoteIP { get; private set; }
        public int Port { get; private set; }
        public string SendContent { get; private set; }
        public int BufferSize { get; private set; }
        public int StartReceiveServiceErrorRetryCount { get; private set; }
        public bool ServerMode { get; private set; }
        public int FactoryCode { get; private set; }
        public string HardwareSerialNum { get; private set; }

        public CraneParams(string[] args)
        {
            Params aParams = new Params();
            aParams.Parse(args);
            RemoteIP = aParams.GetValue("-RemoteIP", IPAddress.Parse("59.110.4.93"));
            Port = aParams.GetValue("-Port", 2214);
            SendContent = aParams.GetValue("-SendContent", "0123456789");
            BufferSize = aParams.GetValue("-BufferSize", 1024);
            StartReceiveServiceErrorRetryCount = aParams.GetValue("-StartReceiveServiceErrorRetryCount", 5);
            ServerMode = aParams.GetValue("-ServerMode", false);
            FactoryCode = aParams.GetValue("-FactoryCode", 4);
            HardwareSerialNum = aParams.GetValue("-HardwareSerialNum", "5678");
        }
    }
}